﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PeopleList.ascx.cs" Inherits="SERP.Modules.People.PeopleList" %>
<%@ Register Src="~/Modules/HRM/Organizations/DropDownListOrganizations.ascx" TagName="DropDownListOrganizations"
    TagPrefix="Organizations" %>
<%@ Register Src="~/Modules/HRM/PersonTypes/DropDownListPersonTypes.ascx" TagName="DropDownListPersonTypes"
    TagPrefix="PersonTypes" %>
<%@ Register Src="../Organizations/OrganizationsTree.ascx" TagName="OrganizationsTree"
    TagPrefix="uc1" %>
<%@ Register Src="../Controls/DropDownListGender.ascx" TagName="DropDownListGender"
    TagPrefix="uc2" %>
<%@ Register Src="../../../Controls/ucDateTime.ascx" TagName="ucDateTime" TagPrefix="uc2" %>
<%@ Register Src="../WorkPositions/DropDownListWorkPositions.ascx" TagName="DropDownListWorkPositions"
    TagPrefix="uc3" %>
<div class="ftitle">
    <a class="ftitlelink" onclick='<%="expandCollapseSearch(\"dvsPeople\",\"imgsPeople\",\""+hsPeople.ClientID+"\",\"drdown.jpg\",\"closeup.jpg\",true);" %>'>
        <asp:HiddenField runat="server" ID="hsPeople" Value="0" />
        <img id='imgsPeople' src='<%=ResolveUrl("~/App_Themes/Default/img/drdown.jpg")%>'>
        <span id="lblTitle" runat="Server" enableviewstate="false"></span></a>
    <div class="toolbar">
        <asp:Button ID="btnHelps" runat="server" Text="Helps" OnClientClick="showHelp(window.localtion)" />
        <asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="OnDelete" />
        <asp:Button ID="btnImport" runat="server" Text="Import" OnClick="OnImport" />
        <asp:Button ID="btnAddNew" runat="server" Text="Addnew" OnClick="OnAddNew" />
    </div>
</div>
<div class="form" id="dvsPeople" style='display: none'>
    <div class="frow">
        <asp:Label ID="labelFullName" runat="server" Text="FullName" CssClass="label" EnableViewState="False"></asp:Label>
        <asp:TextBox runat="server" ID="txtFullName" Width="200"></asp:TextBox><asp:Label
            ID="labelPersonCode" runat="server" Text="PersonCode" CssClass="label" EnableViewState="False"></asp:Label>
        <asp:TextBox runat="server" ID="txtPersonCode" Width="100"></asp:TextBox>
    </div>
    <div class="frow">
        <asp:Label ID="labelGender" runat="server" Text="Gender" CssClass="label" EnableViewState="False"></asp:Label>
        <uc2:DropDownListGender ID="txtGender" runat="server" IsAddAllItem="true" />
        <asp:Label ID="labelBirthDay" runat="server" Text="BirthDay" CssClass="label" EnableViewState="False"></asp:Label>
        <uc2:ucDateTime ID="txtBirthDayFROM" Width="100" runat="server" />
        <span style="margin-right: 8px">-</span>
        <uc2:ucDateTime ID="txtBirthDayTO" Width="100" runat="server" />
        <asp:CheckBox runat="server" ID="cbkFindBirthDay"></asp:CheckBox>
    </div>
    <div class="frow">
        <asp:Label ID="labelAddress" runat="server" Text="Address" CssClass="label" EnableViewState="False"></asp:Label>
        <asp:TextBox runat="server" ID="txtAddress" Width="400"></asp:TextBox>
    </div>
    <div class="frow">
        <asp:Label ID="labelPhone" runat="server" Text="Phone" CssClass="label" EnableViewState="False"></asp:Label>
        <asp:TextBox runat="server" ID="txtPhone" Width="100"></asp:TextBox>
        <asp:Label ID="labelEmail" runat="server" Text="Email" CssClass="label" EnableViewState="False"></asp:Label>
        <asp:TextBox runat="server" ID="txtEmail" Width="200"></asp:TextBox>
    </div>
    <div class="frow">
        <asp:Label ID="labelPositionId" runat="server" Text="PositionId" CssClass="label"
            EnableViewState="False"></asp:Label>
        <uc3:DropDownListWorkPositions ID="txtPositionId" IsAddAllItem="true" Width="100"
            runat="server" />
        <asp:Label ID="labelStartDate" runat="server" Text="StartDate" CssClass="label" EnableViewState="False"></asp:Label>
        <uc2:ucDateTime ID="txtStartDateFROM" Width="100" runat="server" />
        <span style="margin-right: 8px">-</span>
        <uc2:ucDateTime ID="txtStartDateTO" Width="100" runat="server" />
        <asp:CheckBox runat="server" ID="cbkFindStartDate"></asp:CheckBox>
    </div>
    <div class="frow">
        <asp:Label ID="labelNote" runat="server" Text="Note" CssClass="label" EnableViewState="False"></asp:Label>
        <asp:TextBox runat="server" ID="txtNote" Width="400"></asp:TextBox>
    </div>
    <div class="frow">
        <asp:Label ID="labelOrganizationId" runat="server" Text="OrganizationId" CssClass="label"
            EnableViewState="False"></asp:Label>
        <Organizations:DropDownListOrganizations runat="server" ID="txtOrganizationId" IsAddChooseItem="false"
            IsAddAllItem="true" Width="400"></Organizations:DropDownListOrganizations>
    </div>
    <div class="frow">
        <asp:Label ID="labelPersonTypeId" runat="server" Text="PersonTypeId" CssClass="label"
            EnableViewState="False"></asp:Label>
        <PersonTypes:DropDownListPersonTypes runat="server" ID="txtPersonTypeId" IsAddChooseItem="false"
            IsAddAllItem="true" Width="400"></PersonTypes:DropDownListPersonTypes>
    </div>
    <div class="btnbar">
        <asp:Button ID="btnSearch" runat="server" CssClass="button" ValidationGroup="btnSearch"
            OnClick="btnSearch_Click" Text="Tìm kiếm" Width="80px" />
    </div>
</div>
<div>
    <div id="dvTree" style="overflow: scroll-x; float: left; width: 200px; height: 100%">
        <uc1:OrganizationsTree ID="tv" runat="server" OnSelectedNodeChanged="tv_SelectedNodeChanged" />
    </div>
    <div id="dvGrid" style="float: left; width: 400px;border-left: 1px solid #f8f8f8">
        <table class="grid">
            <tr>
                <td class="tblhleft" style="width: 34px">
                    <input type="checkbox" id="cbkCheckAllPeople" name="cbkCheckAllPeople" onclick="SelectAllCheckboxes(this,'cbkPeople')"
                        onchange="selectAllCheckboxes(this,'cbkPeople')">
                </td>
                <td class="tblh" style="width: 34px">
                    <%=SERP.Constants.APP_INDEX%>
                </td>
                <td class="tblh">
                    <%=SERP.StringMappings.PeopleStringMapping.PersonCode%>
                </td>
                <td class="tblh">
                    <%=SERP.StringMappings.PeopleStringMapping.FullName%>
                </td>
                <td class="tblh">
                    <%=SERP.StringMappings.PeopleStringMapping.Phone%>
                </td>
                <td class="tblh">
                    <%=SERP.StringMappings.PeopleStringMapping.Email%>
                </td>
                <td class="tblh">
                    <%=SERP.StringMappings.PeopleStringMapping.BirthDay%>
                </td>
                <td class="tblh" style="width: 30px; text-align: center">
                    <%=SERP.Constants.APP_EDIT%>
                </td>
                <td class="tblh" style="width: 30px; text-align: center">
                    <%=SERP.Constants.APP_DELETE%>
                </td>
            </tr>
            <asp:Repeater runat="server" ID="gridData">
                <ItemTemplate>
                    <tr>
                        <td class="tblcleft">
                            <asp:CheckBox ID="cbkPeople" runat="server" />
                        </td>
                        <td class="tblc">
                            <%#Container.ItemIndex+1%>
                        </td>
                        <td class="tblc">
                            <asp:LinkButton CommandArgument='<%#string.Concat("&PersonId="+Eval("PersonId"))%>'
                                OnCommand="btnXem_OnCommand" runat="server">     
			<%#Eval("PersonCode")%>
                            </asp:LinkButton>
                        </td>
                        <td class="tblc">
                            <asp:LinkButton CommandArgument='<%#string.Concat("&PersonId="+Eval("PersonId"))%>'
                                OnCommand="btnXem_OnCommand" runat="server">     
			<%#Eval("FullName")%>
                            </asp:LinkButton>
                        </td>
                        <td class="tblc">
                            <asp:LinkButton CommandArgument='<%#string.Concat("&PersonId="+Eval("PersonId"))%>'
                                OnCommand="btnXem_OnCommand" runat="server">     
			<%#Eval("Phone")%>
                            </asp:LinkButton>
                        </td>
                        <td class="tblc">
                            <asp:LinkButton CommandArgument='<%#string.Concat("&PersonId="+Eval("PersonId"))%>'
                                OnCommand="btnXem_OnCommand" runat="server">     
			<%#Eval("Email")%>
                            </asp:LinkButton>
                        </td>
                        <td class="tblc">
                            <asp:LinkButton CommandArgument='<%#string.Concat("&PersonId="+Eval("PersonId"))%>'
                                OnCommand="btnXem_OnCommand" runat="server">     
			<%#((DateTime)Eval("BirthDay")).ToString(SERP.Constants.APP_DATE_FORMAT)%>
                            </asp:LinkButton>
                        </td>
                        <td class="tblc" style="text-align: center">
                            <asp:LinkButton ID="btnSua" runat="server" CommandArgument='<%#string.Concat("&PersonId="+Eval("PersonId"))%>'
                                OnCommand="btnSua_OnCommand">
                                <asp:Image ID="imgEdit" runat="server" Style="border: 0" ImageUrl="~/App_Themes/Default/img/edit.jpg" />
                            </asp:LinkButton>
                        </td>
                        <td class="tblc" style="text-align: center">
                            <asp:LinkButton ID="btnXoa" runat="server" CommandArgument='<%#string.Concat("&PersonId="+Eval("PersonId"))%>'
                                OnCommand="btnXoa_OnCommand">
                                <asp:Image ID="imgDelete" runat="server" Style="border: 0" ImageUrl="~/App_Themes/Default/img/delete.jpg" />
                            </asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
        </table>
    </div>
</div>
<script type="text/javascript">
    wnd_sizechanged = function (width, height) {
        var dvTree = document.getElementById("dvTree");
        var dvGrid = document.getElementById("dvGrid");
        dvGrid.style.minHeight = (height - 30) + "px";
        dvGrid.style.width = (width - dvTree.offsetWidth - 2) + "px";
    }
    listenOnSizeChanged(wnd_sizechanged); 
</script>
<% if (this.IsPostBack)
   {%>
<script type="text/javascript">
    expandCollapseSearch("dvsPeople", "imgsPeople", "<%=hsPeople.ClientID%>", "drdown.jpg", "closeup.jpg", false);
</script>
<%}%>
